package com.yeyv.net.Web.Control;

import com.yeyv.net.Security.LoginService;
import com.yeyv.net.UsefulEntity.RedisUtil;
import com.yeyv.net.UsefulEntity.Resp;
import com.yeyv.net.Web.Entity.AccountEntity;
import com.yeyv.net.Web.Service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/auth")
public class AuthController {
    @Autowired
    private AccountService accountService;

    @Autowired
    private LoginService loginService;

    @RequestMapping("/login")
    public Resp<String> login(@RequestParam String account, @RequestParam String password) {
        AccountEntity entity = new AccountEntity();
        entity.setAccount(account);
        entity.setPassword(password);
        return loginService.login(entity);
    }
}
